********************************************************************************
* Exporting table for multi-country COVID paper (KEN1-3 sample)
* last updated: 2020-12-10
* Salim Benhachmi, ML for Kenya
********************************************************************************

clear all
use "$da/KEN1_maintable", clear
gl weight hh_weight

* Drop in income
gen drop_inc = incomedrop 

* increase in income
gen incr_inc = . 

local indicators drop_inc incr_inc

foreach ind of local indicators {
	sum `ind' [aw=$weight]
	loc mean_`ind' : di %10.2fc r(mean)
}

loc ratio = round(`mean_drop_inc' / `mean_incr_inc', 0.1)

clear
set obs 1

gen drop_inc = "`mean_drop_inc'"
gen incr_inc = "`mean_incr_inc'"
gen ratio = "`ratio'"

export excel using "$dtab/Inverse Table.xlsx", sheetmodify cell(B18)

********************************************************************************

clear all
use "$da/KEN2_maintable", clear
gl weight weight

* Drop in income
gen drop_inc = inc3_total_drop  

* increase in income
gen incr_inc = inc3_total_increase

local indicators drop_inc incr_inc

foreach ind of local indicators {
	sum `ind' [aw=$weight]
	loc mean_`ind' : di %10.2fc r(mean)
}

loc ratio = round(`mean_drop_inc' / `mean_incr_inc', 0.1)

clear
set obs 1

gen drop_inc = "`mean_drop_inc'"
gen incr_inc = "`mean_incr_inc'"
gen ratio = "`ratio'"

export excel using "$dtab/Inverse Table.xlsx", sheetmodify cell(B19)

********************************************************************************

clear all
use "$da/KEN3_maintable", clear
gl weight hh_weight

* Drop in income
gen drop_inc = inc3_total_drop  

* increase in income
gen incr_inc = inc3_total_increase


local indicators drop_inc incr_inc

foreach ind of local indicators {
	sum `ind' [aw=$weight]
	loc mean_`ind' : di %10.2fc r(mean)
}

loc ratio = round(`mean_drop_inc' / `mean_incr_inc', 0.1)

clear
set obs 1

gen drop_inc = "`mean_drop_inc'"
gen incr_inc = "`mean_incr_inc'"
gen ratio = "`ratio'"

export excel using "$dtab/Inverse Table.xlsx", sheetmodify cell(B20)
